import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:library_base/constant/constant.dart';
import 'package:library_base/entities/device_entity.dart';
import 'package:library_base/ext/theme_data_ext.dart';
import 'package:library_base/global/multi_language.dart';
import 'package:library_base/res/decoration.dart';
import 'package:library_base/res/edge.dart';
import 'package:library_base/res/gaps.dart';
import 'package:library_base/utils/theme_util.dart';
import 'package:library_base/widget/button/gradient_button.dart';
import 'package:library_base/widget/button/ink_bg_well.dart';
import 'package:library_base/widget/image/local_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

Widget buildItem(
  DeviceEntity model, {
  Callback<DeviceEntity>? onTap,
  Function(DeviceEntity)? connect,
}) {
  return Container(
    decoration: rs8,
    margin: edgeLR24,
    child: Column(
      children: [
        Row(
          children: [
            gapW18,
            Container(
              width: 20.w,
              height: 20.w,
              color: ThemeUtil.getTheme().fourthBgColor(),
            ),
            Expanded(child: Container()),
            Container(
              width: 20.w,
              height: 20.w,
              color: ThemeUtil.getTheme().fourthBgColor(),
            ),
            gapW18,
          ],
        ),
        Container(
          alignment: Alignment.center,
          width: double.infinity,
          height: 350.w,
          child: Stack(
            fit: StackFit.expand,
            children: [
              Positioned(
                  top: 160.w,
                  left: 100.w,
                  child: LocalImage(
                    'common_printer01_shadow',
                    package: Constant.packLib(),
                    width: 500.w,
                    height: 200.w,
                  )),
              Positioned(
                  left: 200.w,
                  child: LocalImage(
                    'common_printer01',
                    package: Constant.packLib(),
                    width: 300.w,
                    height: 288.w,
                  ))
            ],
          ),
        ),
        Container(alignment: Alignment.center, child: Text(model.getName())),
        gapH18,
        GradientButton(
          ThemeUtil.getTheme(),
          margin: edgeLR24 as EdgeInsets,
          padding: edgeV24 as EdgeInsets,
          width: double.infinity,
          text: MultiLanguage.connected1.tr,
          onPressed: () {
            connect?.call(model);
          },
        ),
        gapH18,
      ],
    ),
  );
}
